import * as utils from '../utils'

/**
 * 规范化命名，如将accept ACCEPT 统一设置纯 Accept
 * @param headers headers
 * @param normalizedName 属性名
 */
export default function normalizeHeaderName(headers: any, normalizedName: string): void {
  utils.forEach(headers, function processHeader(value, name) {
    if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
      headers[normalizedName] = value;
      delete headers[name];
    }
  });
};
